package com.aichongbang.acb.service.impl;

import com.aichongbang.acb.po.Customer;
import com.aichongbang.acb.mapper.CustomerMapper;
import com.aichongbang.acb.service.ICustomerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author acb
 * @since 2021-05-27
 */
@Service("customerService")
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService {
    @Resource
    public CustomerMapper customerMapper;

    @Override
    public List<Customer> getAll() {
        return customerMapper.getAll();
    }

    @Override
    public int add(Customer customer) {
        return customerMapper.add(customer);
    }

    @Override
    public boolean update(Customer customer) {
        int num = customerMapper.update(customer);
        return num > 0 ? true : false;
    }

    @Override
    public boolean delete(Integer id) {
        int num = customerMapper.delete(id);
        return num > 0? true : false;
    }

    @Override
    public Customer getItemById(Integer tId) {
        return customerMapper.getItemById(tId);
    }
}
